#ifndef PLATFORM_H
#define PLATFORM_H

//
//standard c library
//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>


//
//udk library
//
#include "udk_types.h"

/*
 * We defined some platfrom independent APIs or data types
*/
#define udk_get_ticks pd_get_ticks
#define udk_msleep pd_msleep
#define udk_dlopen pd_dlopen
#define udk_dlsym  pd_dlsym
#define udk_dlerr  pd_dlerror
#define udk_dlclose  pd_dlclose
#define udk_malloc pd_malloc
#define udk_free   pd_free
#define udk_dump   pd_dump

#define UDK_DLLIMPORT PD_DLLIMPORT
#define UDK_API 	PD_UDK_API
#define UDK_RTLIBPREFIX PD_RTLIBPREFIX
#define UDK_RTLIBSUFFIX PD_RTLIBSUFFIX

/*
 *Platform dependent APIs
*/
unsigned long 
	pd_get_ticks(void);
void 
	pd_msleep(int ms);
void *
	pd_dlopen(const char *filename, int flag/*0 if unused*/);

const char *
	pd_dlerror(void);

void *
	pd_dlsym(void *handle, const char *symbol);

int 
	pd_dlclose(void *handle);

void 
	pd_dump(const char *function,const char *data ,int size);

#define pd_malloc malloc
#define pd_free	  free

/*
 * Platform dependent header files
*/
//platfrom win32
#if defined(WIN32)
#include <pd_win32.h>


//platform android
#elif defined(ANDROID)
#include <pd_android.h>

//platform ios
#elif defined(__APPLE__)
#include <pd_ios.h>
//platform linux
#elif defined(__linux)
#include <pd_linux.h>
#else
#error "we should not reach here"
#endif

#endif
